//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "aisuppress\fn_addSphere.sqf"
#include <core_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;
private ["_unit","_sphere","_idx"];
DEFAULT_PARAM(_unit,0,objNull);
_sphere = objNull;
if (GVAR(DEBUG_SPHERE)) then {
	_sphere = _unit getVariable [QGVAR(DEBUG_SPHERE),objNull];
	if (isNull _sphere) then {
		//Sign_Sphere10cm_F
		//Sign_Sphere100cm_F
		_sphere = "Sign_Sphere25cm_F" createVehicle [0,0,0];
		_sphere attachTo [_unit,[0,0,2]];
		_idx = _unit addEventHandler ["killed",{
			private "_sphere";
			_sphere = (_this select 0) getVariable [QGVAR(DEBUG_SPHERE),objNull];
			if (!isNull _sphere) then { detach _sphere; deleteVehicle _sphere; };
		}];
		_unit setVariable [QGVAR(DEBUG_SPHERE),_sphere,true];
		_unit setVariable [QGVAR(DEBUG_SPHERE_EVT),_idx];
		_sphere setObjectTextureGlobal [0,"#(argb,8,8,3)color(1,1,1,0.6)"];
		TRACE_1("Debug Sphere Added",_unit);
	};
};
TRACE("End");
TMFPROFILERSTOP;
_sphere;